package com.dzu.easy;

/**
 * @author ZhaoDong
 * @date 2022/9/27 10:26
 * @description leetcode
 */
public class Test520 {

    public static void main(String[] args) {
        System.out.println(detectCapitalUse("Google"));
    }

    public static boolean detectCapitalUse(String word) {
        String upperCase = word.toUpperCase();
        if (word.equals(upperCase)) {
            return true;
        }
        String lowerCase = word.toLowerCase();
        if (word.equals(lowerCase)) {
            return true;
        }

        String substring = word.substring(0, 1);
        String substring2 = word.substring(1);
        return substring.toUpperCase().equals(substring) && substring2.toLowerCase().equals(substring2);

    }
}
